<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateConfigsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('configs')) {
            Schema::create('configs', function (Blueprint $table) {
                $table->id();
                $table->enum('group', ['wechat', 'ali', 'system'])->default('system')->comment('配置分组');
                $table->string('name')->comment('配置名称');
                $table->string('key')->uniqid()->comment('配置键');
                $table->string('value')->comment('配置值');
                $table->string('desc')->nullable()->comment('配置描述');
                $table->timestamps(0);
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('configs');
    }
}
